<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<style type="text/css">
.dateWidth1 {
	width: 195px;
}

.select_width {
	width: 130px;
}
</style>
<x:parse xml="${param.xmlstr}" var="xmlData" />

<table class="t_css" width="100%" border="0" cellpadding="0"
	id="basicInfoex" cellspacing="1">
	<tr>
		<td colspan="6" class="t_bar2">商业街基本情况</td>

	</tr>
	<tr>
		<td align="right" style="width: 11%"><span class="color_red">*</span>商业街名称：</td>
		<td colspan="3"><input id="street_name" name="proposal/street_name"
			label="商业街名称" type="text" required
			class="input_css required maxlength:100" style="width: 725px;"
			maxlength="100"
			value="<x:out select="$xmlData/data/proposal/street_name" />" /></td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>投资单位：</td>
		<td colspan="3"><input id="org_inverst" name="proposal/org_inverst"
			label="投资单位" type="text" required
			class="input_css required maxlength:100" style="width: 725px;"
			maxlength="100"
			value="<x:out select="$xmlData/data/proposal/org_inverst" />" /></td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>评定称号：</td>
		<td nowrap  valign="middle" colspan="3">
		<label> <input type="radio" class="do " id="advant_01" style="vertical-align: middle;" name="research" label="国家级“著名商业街”“特色商业街”" value="01" /><span style="vertical-align: middle;">国家级“著名商业街”“特色商业街”</span></label> 
		<label> <input type="radio" class="do " id="advant_02" style="vertical-align: middle;" name="research" label="市级特色商业街区" value="02" /><span style="vertical-align: middle;">市级特色商业街区</span></label> 
		<input type="hidden" name="proposal/research_value" id="research_value" class="required" value="<x:out select="$xmlData/data/proposal/research_value" />" label="评定称号" /> 
		<input type="hidden" name="proposal/research_name" id="research_name" value="<x:out select="$xmlData/data/proposal/research_name" />" label="评定称号" /></td>
	</tr>
	<tr>
		
		<td align="right" nowrap><span class="color_red">*</span>评定机构：</td>
		<td><input name="proposal/pd_org" label="评定机构" type="text" style="width: 200px;"
			required class="input_css required maxlength:100" maxlength="100"
			value="<x:out select="$xmlData/data/proposal/pd_org" />" /></td>
		<td align="right" nowrap><span class="color_red">*</span>评定时间：</td>
		<td>
			<c:set var="pd_date"><x:out select="$xmlData/data/proposal/pd_date" /></c:set>
			<cpt:date id="pd_date" name="proposal/pd_date" value="${pd_date}" className=" required date" label="评定时间"></cpt:date>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>商业街地址：</td>
		<td colspan="1"  style="width: 40%"><input id="yq_address" name="proposal/yq_address"
			label="商业街地址" type="text" required style="width: 200px;"
			class="input_css required maxlength:100"
			maxlength="100"
			value="<x:out select="$xmlData/data/proposal/yq_address" />" /></td>
		<td align="right"  style="width: 18%"><span class="color_red">*</span>商业街面积（平方米）：</td>
		<td colspan="1"><input id="yq_area" name="proposal/yq_area" style="width: 200px; text-align: right;"
			label="商业街面积" type="text" required onfocus="InitInput.setNumber(this,7,2,2)"
			class="input_css required maxlength:100"
			maxlength="100"
			value="<x:out select="$xmlData/data/proposal/yq_area" />" /></td>
	</tr>
	
</table>
<table class="t_css" width="100%" border="0" cellpadding="0" cellspacing="1" id="basicInfoex2">

	<tr>
		<td colspan="5" class="t_bar2"><span class="color_red">*</span>商业街入驻企信息</td>

	</tr>
	<tr >
		<td align="right" style="width: 17%">商业街入驻企业数（家）：</td>
		<td colspan="4">
		<input id="org_count" name="orginfo/org_count" label="商业街入驻企业数" onchange="countPreOrg()" style="text-align: right;" onfocus="InitInput.setNumber(this,9,0,0)" class="valueGreatEqual:org_count:over_th_count" value="<x:out select="$xmlData/data/orginfo/org_count" />"/>
		</td>
	</tr>
	<tr>
		<td align="center" rowspan="3">其中：</td>
		<td align="right" style="33%">年销售超二百万元企业数（家）：</td>
		<td style="20%"><input id="over_th_count" label="年销售超二百万元企业数" onchange="countPreOrg()" name="orginfo/over_th_count" style="text-align: right;" onfocus="InitInput.setNumber(this,9,0,0)"  class="valueGreatEqual:over_th_count:over_fth_count" value="<x:out select="$xmlData/data/orginfo/over_th_count" />"/>		</td>
		<td align="right" style="10%">占比%：</td>
		<td style="20%"><input id="over_th_count_pre" disabled="disabled" name="orginfo/over_th_count_pre" style="text-align: right;" onfocus="InitInput.setNumber(this,9,4,2)" class=" gray" value="<x:out select="$xmlData/data/orginfo/over_th_count_pre" />"/>		</td>
	</tr>
	<tr>
		<td align="right">年销售超五百万元企业数（家）：</td>
		<td><input id="over_fth_count" label="年销售超五百万元企业数"  onchange="countPreOrg()" name="orginfo/over_fth_count"  style="text-align: right;" onfocus="InitInput.setNumber(this,9,0,0)"  class="valueGreatEqual:over_fth_count:over_mth_count" value="<x:out select="$xmlData/data/orginfo/over_fth_count" />"/></td>
		<td align="right">占比%：</td>
		<td><input id="over_fth_count_pre" disabled name="orginfo/over_fth_count_pre" style="text-align: right;" onfocus="InitInput.setNumber(this,9,4,2)"class=" gray" value="<x:out select="$xmlData/data/orginfo/over_fth_count_pre" />"/></td>
	</tr>
	<tr>
		<td align="right">年销售超一千万元企业数（家）：</td>
		<td><input id="over_mth_count" label="年销售超一千万元企业数" onchange="countPreOrg()" name="orginfo/over_mth_count" style="text-align: right;" onfocus="InitInput.setNumber(this,9,0,0)" value="<x:out select="$xmlData/data/orginfo/over_mth_count" />"/></td>
		<td align="right">占比%：</td>
		<td><input id="over_mth_count_pre" disabled name="orginfo/over_mth_count_pre" style="text-align: right;" onfocus="InitInput.setNumber(this,9,4,2)" class="gray" value="<x:out select="$xmlData/data/orginfo/over_mth_count_pre" />"/></td>
	</tr>
</table>
<table class="t_css" width="100%" border="0" cellpadding="0" cellspacing="1" id="basicInfoex3">
	<tr>
		<td colspan="6" class="t_bar2">${year-1 }商业街经济效益情况（万元）</td>

	</tr>
	<tr >
	<td align="right">销售总额：</td>
	<td>
	<input type="hidden" id="sell1" name="invests/sell_2011" value="<x:out select="$xmlData/data/organization/finances/finance[@sequence_no='3']/income" />"/>
	<span name="invests/sell" id="sell2"><x:out select="$xmlData/data/organization/finances/finance[@sequence_no='5']/income" /></span></td>
	<td align="right">同比增幅%：</td>
	<td><input name="invests/increase1" style="text-align: right;" id="increase1" value="<x:out select="$xmlData/data/invests/increase1" />" onfocus="InitInput.setNumber(this,9,2,2)"></td>
	</tr>
	<tr >
	<td align="right">利润总额：</td>
	<td>
	<input type="hidden" id="profit1" name="invests/profit_2011" value="<x:out select="$xmlData/data/organization/finances/finance[@sequence_no='3']/proft_total" />"/>
	<span name="invests/profit" id="profit2"><x:out select="$xmlData/data/organization/finances/finance[@sequence_no='5']/proft_total" /></span></td>
	<td align="right">同比增幅%：</td>
	<td><input name="invests/increase2" style="text-align: right;" id="increase2" value="<x:out select="$xmlData/data/invests/increase2" />" onfocus="InitInput.setNumber(this,9,2,2)"></td>
	</tr>
	<tr >
	<td align="right">税收总额：</td>
	<td>
	<input type="hidden" id="tax1" name="invests/tax_2011" value="<x:out select="$xmlData/data/organization/finances/finance[@sequence_no='3']/fax" />"/>
	<span name="invests/tax" id="tax2"><x:out select="$xmlData/data/organization/finances/finance[@sequence_no='5']/fax" /></span></td>
	<td align="right">同比增幅%：</td>
	<td><input name="invests/increase3" style="text-align: right;" id="increase3" value="<x:out select="$xmlData/data/invests/increase3" />" onfocus="InitInput.setNumber(this,9,2,2)"></td>
	</tr>
</table>

<script type="text/javascript">
$(function(){
	$("#total_assets").text(formatVal2($("#finance_930_4").text().replace(new RegExp("\,","g"), "")));
	$("#net_asset").text(formatVal2($("#finance_931_4").text().replace(new RegExp("\,","g"), "")));
	$("#business_sale").text(formatVal2($("#finance_90_4").text().replace(new RegExp("\,","g"), "")));
	$("#total_add").text(formatVal2($("#finance_920_4").text().replace(new RegExp("\,","g"), "")));
	$("#total_business").text(formatVal2($("#finance_921_4").text().replace(new RegExp("\,","g"), "")));
	$("#total_organization").text(formatVal2($("#finance_922_4").text().replace(new RegExp("\,","g"), "")));
	countFundSpanAuto("total_","add,business,organization","total");
	
	//总部功能
	var chkLast = $("input[name='office_function']:last");
	var chkTd = chkLast.parent("td");
	var chk_characteristic_table = chkTd.parent("tr").parent("tbody");
	chk_characteristic_table.parent("table").attr("border","0");
	var trLen = chk_characteristic_table.find("tr").length;
	var tdLen = chk_characteristic_table.find("td").length;
	var tdNum = parseInt(tdLen%trLen==0 ? tdLen/trLen : (tdLen/trLen+1));
	chkTd.append('&nbsp;<input type="text" style="display:none" id="office_function_other" maxlength="20" name="proposal/office_function_other" value="${office_function_other}"/>');
	chkTd.attr("colspan", (1+tdNum));
	var chkOther = $("#office_function_other");
	if ($.trim(chkTd.text())=="其他" && chkLast.attr("checked")=="checked") {
		chkOther.show();
	}
	chkOther.keyup(function(){
		setChkValues("office_function");
	});
	
	regChkClickAction("office_function");//给checkbox注册点击事件
});

/**
 * 给checkbox注册点击事件
 */
function setChkValues(chkName) {
	var str_value = "";
	var str_name = "";
	var text = "";
	$("input[name='"+chkName+"']:checked").each(function(){
		str_value += "，"+$(this).val();
		text = $.trim($(this).parent().text());
		if (text == "其他" && chkName == "office_function") {
			if ($.trim($("#"+chkName+"_other").val()) != "")
				str_name += "，"+$("#"+chkName+"_other").val();
		} else {
			str_name += "，"+text;
		}
	});
	if (str_value.length > 0) {
		$("input[name$='"+chkName+"_value']").val(str_value.substring(1));
		$("input[name$='"+chkName+"_name']").val(str_name.substring(1));
	}
}
function regChkClickAction(chkName) {
	$("input[name='"+chkName+"']").click(function(){
		if (chkName == "office_function" && $.trim($(this).parent("td").text()) == "其他") {
			if ($(this).attr("checked") == "checked") {
				$("#"+chkName+"_other").show();
			}
			else {
				$("#"+chkName+"_other").hide();
				$("#"+chkName+"_other").val("");
			}
		}
		setChkValues(chkName);
	});
}



function setPre(){
	var  teach_staff=$("#teach_staff").val();
    var staff_total=$("#staff_total").val();
    $("#teach_staff_pre").val(formatVal(teach_staff*100/staff_total));
    
    var  research_staff=$("#research_staff").val();
   
    $("#research_staff_pre").val(formatVal(research_staff*100/staff_total));
    
    var  technology_staff=$("#technology_staff").val();
   
    $("#technology_staff_pre").val(formatVal(technology_staff*100/staff_total));
	
}

function countFundSpanAuto(idStart, countStr, totalStr) {

	var indexs = countStr.split(",");
	var count = 0;
	for ( var i = 0; i < indexs.length; i++) {
		var fund = $("#" + idStart + indexs[i]).text();
		if (!$.isNumeric(fund))
			fund = "0";
		count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(4);
	}

	count = formatNumberAuto(count.toString(), 9, 4, 2);// 格式化金额
	$("#" + idStart + totalStr).text(count);
}

function setEuipmentTotal(){
	var count = 1;
	var budget_pre_total = 0.00;
	var income_total = 0.00;
	var sale_total = 0.00;
	$("#tblEuipments tbody tr").each(function(){
		if(count!=1){//跳过第一行模版行
			var tr = $(this);
			var budget_pre = tr.find("input[id^='euipment_budget_pre']").first().val();
			var income = tr.find("input[id^='euipment_income']").first().val();
			var sale = tr.find("input[id^='euipment_sale']").first().val();
			if(budget_pre!=null && $.isNumeric(budget_pre)&& parseFloat(budget_pre)>0) budget_pre_total = parseFloat(budget_pre_total) + parseFloat(budget_pre);
			if(income!=null && $.isNumeric(income)&& parseFloat(income)>0) income_total = parseFloat(income_total) + parseFloat(income);
			if(sale!=null && $.isNumeric(sale)&& parseFloat(sale)>0) sale_total = parseFloat(sale_total) + parseFloat(sale);
		}
		count++;
	});
	$("#budget_pre_total").val(formatNumberAutoPro(budget_pre_total));
	$("#income_total").val(formatNumberAutoPro(income_total));
	$("#sale_total").val(formatNumberAutoPro(sale_total));
}
$(function(){
	$("#add1").text(formatVal($("#sell2").text().replace(new RegExp("\,","g"), "")-$("#sell1").val().replace(new RegExp("\,","g"), "")));
	if($("#sell1").val()==0 || $("#sell1").val() == ''){
		$("#increase1").text("0.00");
	}else{
	$("#increase1").text(formatVal(($("#sell2").text().replace(new RegExp("\,","g"), "")-$("#sell1").val().replace(new RegExp("\,","g"), ""))*100/Math.abs($("#sell1").val().replace(new RegExp("\,","g"), ""))));
	}
	$("#add2").text(formatVal($("#profit2").text().replace(new RegExp("\,","g"), "")-$("#profit1").val().replace(new RegExp("\,","g"), "")));
	if($("#profit1").val()==0 || $("#profit1").val() == ''){
		$("#increase2").text("0.00");
	}else{
	$("#increase2").text(formatVal(($("#profit2").text().replace(new RegExp("\,","g"), "")-$("#profit1").val().replace(new RegExp("\,","g"), ""))*100/Math.abs($("#profit1").val().replace(new RegExp("\,","g"), ""))));
	}
	
	$("#add3").text(formatVal($("#tax2").text().replace(new RegExp("\,","g"), "")-$("#tax1").val().replace(new RegExp("\,","g"), "")));
	if($("#tax1").val()==0 || $("#tax1").val() == ''){
		$("#increase1").text("0.00");
	}else{
	$("#increase3").text(formatVal(($("#tax2").text().replace(new RegExp("\,","g"), "")-$("#tax1").val().replace(new RegExp("\,","g"), ""))*100/Math.abs($("#tax1").val().replace(new RegExp("\,","g"), ""))));
	}
});
function countPreOrg() {
	 var total = $("#org_count").val();
	 var over_th_count = $("#over_th_count").val();
	 var over_fth_count = $("#over_fth_count").val();
	 var over_mth_count = $("#over_mth_count").val();
	 if(!$.isNumeric(total)) total = "0";
	 if(!$.isNumeric(over_mth_count)) over_mth_count = "0";
	 if(!$.isNumeric(over_th_count)) over_th_count = "0";
	 if(!$.isNumeric(over_fth_count)) over_fth_count = "0";
	 if(total=="0") {
		 $("#over_th_count_pre").val("0.00");
		 $("#over_fth_count_pre").val("0.00");
		 $("#over_mth_count_pre").val("0.00");
	 } else {
		 var over_fth_count_pre = formatNumberAutoProEx(parseFloat(over_fth_count)/parseFloat(total)*100);
		 var over_th_count_pre = formatNumberAutoProEx(parseFloat(over_th_count)/parseFloat(total)*100);
		 var over_mth_count_pre = formatNumberAutoProEx(parseFloat(over_mth_count)/parseFloat(total)*100);
		 $("#over_th_count_pre").val(over_th_count_pre);
		 $("#over_fth_count_pre").val(over_fth_count_pre);
		 $("#over_mth_count_pre").val(over_mth_count_pre);
	 }
 }
function formatNumberAutoPro(val){
	var count;
	if((formatNumberAuto(val.toString(), 9, 4, 2)*10000)%10000!=0)
		count=formatNumberAuto(val.toString()+'0000', 9, 4, 2);
	else
		count = formatNumberAuto(val.toString()+".0000", 9, 4, 2);
	return count;
}

function formatNumberAutoProEx(val){
	var count;
	if((formatNumberAuto(val.toString(), 9, 4, 2)*10000)%10000!=0)
		count=formatNumberAuto(val.toString()+'00', 9, 2, 2);
	else
		count = formatNumberAuto(val.toString()+".00", 9, 2, 2);
	return count;
}

</script>
